package com.itheima.home_work.work1;

import java.io.File;

public class Test {
    public static void main(String[] args) {
        // 测试
        String path = "D:\\ITCAST\\唐老师\\JavaSE进阶\\day09-字符集、IO流（一）\\代码\\完整版代码\\Javase_pro\\stream-file-app\\src\\com";
        findAllJavaFile(path);
    }

    public static void findAllJavaFile(String dirPath) {
        File dir = new File(dirPath);
        File[] files = dir.listFiles();

        for (int i = 0; i < files.length; i++) {
            if (files[i].isFile() && files[i].getPath().endsWith(".java")) {
                System.out.println("java文件: " + files[i].getPath());
            }
            if (files[i].isDirectory()) {
                findAllJavaFile(files[i].getPath());
            }
        }
        return;
    }
}
